/*
 * @description Panel to working area
 * @see src/edu/cmu/cs/stage3/alice/authoringtool/editors/compositeeditor/CompositeComponentElementPanel.java: CompositeComponentElementPanel()
 */

package edu.cmu.cs.stage3.alice.authoringtool.editors.compositeeditor;

import edu.cmu.cs.stage3.resourceBundle.I18n;

public class InsertPanel extends javax.swing.JPanel implements java.awt.dnd.DropTargetListener {

 protected javax.swing.JLabel m_label = new javax.swing.JLabel();
 protected String m_doNothingLabel = I18n.getString("doNothing"); // " Do Nothing"

private static int staticCont = 0;
public static final int cont = staticCont++;

 public InsertPanel () {
  System.out.println("InsertPanel.java: InsertPanel(): cont="+cont+" "+staticCont);
  //T try {String str=""; System.out.println(str.charAt(3));}catch(Exception e) {e.printStackTrace();}
  //T edu.cmu.cs.stage3.util.StrUtilities.findMainContainer(this,true);

  setDropTarget( new java.awt.dnd.DropTarget( this, this ) );
  m_label.setDropTarget( new java.awt.dnd.DropTarget( this, this ) );
  m_label.setFont(m_label.getFont().deriveFont(java.awt.Font.ITALIC));
  this.setOpaque(false);
  this.setLayout(new java.awt.GridBagLayout());
  this.add(m_label, new java.awt.GridBagConstraints(0,0,1,1,0,0,java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.NONE, new java.awt.Insets(0,0,0,0), 0,0));
  this.add(javax.swing.Box.createHorizontalGlue(), new java.awt.GridBagConstraints(1,0,1,1,1,1,java.awt.GridBagConstraints.WEST, java.awt.GridBagConstraints.HORIZONTAL, new java.awt.Insets(0,0,0,0), 0,0));
  this.setMaximumSize(new java.awt.Dimension(2400, 30));
  this.setMinimumSize(new java.awt.Dimension(0,0));
  this.setBorder(null);
  m_label.setText(m_doNothingLabel);
  }

 //Rem @Override
 public void paintComponent (java.awt.Graphics g) {
  java.awt.Rectangle r = new java.awt.Rectangle(0,0,this.getWidth(), this.getHeight());
  edu.cmu.cs.stage3.alice.authoringtool.util.GUIEffects.paintTrough(g, r, 12, 10);
  }

 // getParent() must be 'edu.cmu.cs.stage3.alice.authoringtool.viewcontroller.PropertyViewController'
 public void dragEnter (java.awt.dnd.DropTargetDragEvent dtde) {
System.out.println("InsertPanel.java: dragEnter(java.awt.dnd.DropTargetDragEvent): getParent="+edu.cmu.cs.stage3.util.StrUtilities.getComponentName(getParent()));
  if (getParent() instanceof java.awt.dnd.DropTargetListener) {
   ((java.awt.dnd.DropTargetListener)getParent()).dragEnter( dtde );
  } else {
   dtde.rejectDrag();
   }
  }

 public void dragExit (java.awt.dnd.DropTargetEvent dte) {
  if (getParent() instanceof java.awt.dnd.DropTargetListener) {
   ((java.awt.dnd.DropTargetListener)getParent()).dragExit( dte );
   }
  }

 public void dragOver (java.awt.dnd.DropTargetDragEvent dtde) {
  if (getParent() instanceof java.awt.dnd.DropTargetListener) {
   ((java.awt.dnd.DropTargetListener)getParent()).dragOver( dtde );
  } else {
   dtde.rejectDrag();
   }
  }

 public void drop (java.awt.dnd.DropTargetDropEvent dtde) {
  if (getParent() instanceof java.awt.dnd.DropTargetListener) {
   ((java.awt.dnd.DropTargetListener)getParent()).drop( dtde );
  } else {
   dtde.rejectDrop();
   }
  }

 public void dropActionChanged (java.awt.dnd.DropTargetDragEvent dtde) {
  if (getParent() instanceof java.awt.dnd.DropTargetListener) {
   ((java.awt.dnd.DropTargetListener)getParent()).dropActionChanged( dtde );
  } else {
   System.err.println("Error: InsertPanel.java: dragEnter(java.awt.dnd.DropTargetDragEvent):");
   dtde.rejectDrag();
   }
  }

 }
